/*
 * @Author: liyanwei 15230656038@163.com
 * @Date: 2023-10-17 11:36:46
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2023-10-17 16:22:33
 * @FilePath: \cesium-vue3-vite\vite.config.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import path from 'path'
import cesium from 'vite-plugin-cesium'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    AutoImport({
      imports: ['vue', 'vue-router'],
      resolvers: [ElementPlusResolver()],
      eslintrc: {
        enabled: true
      }
    }),
    Components({
      resolvers: [ElementPlusResolver()]
    }),
    cesium()
  ],
  resolve: {
    alias: {
      '@': path.resolve(__dirname, 'src')
    }
  },
  build: {
    commonjsOptions: {
      strictRequires: true // 兼容commonjs
    }
  }
  // server: {
  //   proxy: {
  //     "/api": {
  //       target: "http://localhost:3000",
  //       rewrite: (path) => path.replace(/^\/api/, "")
  //     }
  //   }
  // }
})
